<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0 user-scalable=no">
    <link rel="stylesheet" href="css/outboundTour.css">
    <link rel="stylesheet" href="css/swiper.min.css">
    <title>出境游</title>
</head>

<body>
    <div class="top">
        <div class="topTitle">
            <img class="topTitleimg1" src="https://m.youxiake.com/20250904152805/img/white_back.d9aacddb.png" alt="返回" onclick="window.history.back()">
            <p>出境游</p>
            <img class="topTitleimg2" src="https://m.youxiake.com/20250904152805/img/usercenter.f80b57f0.png" alt="">
        </div>
        <div class="topSearch">
            <div class="topSearch-s">
                <img src="https://m.youxiake.com/20250904152805/img/search.8e9c71e0.png" alt="">
                <p>搜索目的地/关键词</p>
            </div>
        </div>
        <div class="swiper-container">
            <div class="swiper-wrapper"></div>
            <div class="swiper-pagination"></div>
        </div>
    </div>
    <div class="popular">
        <p class="popular-title">人气尖货</p>
        <div class="popular-look">
            <p>查看榜单</p>
            <img src="https://m.youxiake.com/20250904175225/img/rightArrow.ff5dfaac.png" alt="">
        </div>
    </div>
    <ul class="popular-list">
        <li>
            <div class="popular-list-img">
                <img class="popular-list-img1"
                    src="https://gallery.youxiake.com/product/line/202406/27/1719470643783.jpg?imageMogr2/auto-orient/gravity/Center/crop/1000x750/blur/1x0/quality/100"
                    alt="">
                <img class="popular-list-img2" src="https://m.youxiake.com/20250904175225/img/1.87085b16.png" alt="">
                <div class="popular-list-img3">
                    <img src="https://m.youxiake.com/20250904175225/img/fire.ced59379.png" alt="">
                    <p>1781人已报名</p>
                </div>
                <img class="popular-list-img4" src="https://m.youxiake.com/20250904175225/img/top1.e93b8882.png" alt="">
            </div>
            <div class="popular-list-bottom">
                <p class="popular-type">懒人慢游·上海或胡志明...出发</p>
                <p class="popular-name">越南度假</p>
                <div class="popular-pd">
                    <p class="pd-price">
                        <span class="pd-price1">￥</span>
                        <span class="pd-price2">5280</span>
                        <span class="pd-price3">起</span>
                    </p>
                    <p class="pd-day">6~7天</p>
                </div>
            </div>
        </li>
        <li>
            <div class="popular-list-img">
                <img class="popular-list-img1"
                    src="https://gallery.youxiake.com/product/line/202507/16/1752649860955bBLNk.jpg?imageMogr2/auto-orient/gravity/Center/crop/1000x750/blur/1x0/quality/100"
                    alt="">
                <img class="popular-list-img2" src="https://m.youxiake.com/20250904175225/img/2.45836fa8.png" alt="">
                <div class="popular-list-img3">
                    <img src="https://m.youxiake.com/20250904175225/img/fire.ced59379.png" alt="">
                    <p>2344人已报名</p>
                </div>
            </div>
            <div class="popular-list-bottom">
                <p class="popular-type">小众风光·大阪出发</p>
                <p class="popular-name">原宿日本</p>
                <div class="popular-pd">
                    <p class="pd-price">
                        <span class="pd-price1">￥</span>
                        <span class="pd-price2">11380</span>
                        <span class="pd-price3">起</span>
                    </p>
                    <p class="pd-day">8天7晚</p>
                </div>
            </div>
        </li>
        <li>
            <div class="popular-list-img">
                <img class="popular-list-img1"
                    src="https://gallery.youxiake.com/product/line/202508/26/1756192290843URzWc.jpg?imageMogr2/auto-orient/gravity/Center/crop/1000x750/blur/1x0/quality/100"
                    alt="">
                <img class="popular-list-img2" src="https://m.youxiake.com/20250904175225/img/3.bdf4cc10.png" alt="">
                <div class="popular-list-img3">
                    <img src="https://m.youxiake.com/20250904175225/img/fire.ced59379.png" alt="">
                    <p>1946人已报名</p>
                </div>
            </div>
            <div class="popular-list-bottom">
                <p class="popular-type">亲子休闲·上海或新加坡出发</p>
                <p class="popular-name">趣玩新加坡</p>
                <div class="popular-pd">
                    <p class="pd-price">
                        <span class="pd-price1">￥</span>
                        <span class="pd-price2">13980</span>
                        <span class="pd-price3">起</span>
                    </p>
                    <p class="pd-day">5天4晚</p>
                </div>
            </div>
        </li>
        <li>
            <div class="popular-list-img">
                <img class="popular-list-img1"
                    src="https://gallery.youxiake.com/product/line/202407/05/1720157897635.jpg?imageMogr2/auto-orient/gravity/Center/crop/1000x750/blur/1x0/quality/100"
                    alt="">
                <img class="popular-list-img2" src="https://m.youxiake.com/20250904175225/img/4.9f6bdec4.png" alt="">
                <div class="popular-list-img3">
                    <img src="https://m.youxiake.com/20250904175225/img/fire.ced59379.png" alt="">
                    <p>461人已报名</p>
                </div>
            </div>
            <div class="popular-list-bottom">
                <p class="popular-type">徒步登山·纪伊田边出发</p>
                <p class="popular-name">熊野古道徒步</p>
                <div class="popular-pd">
                    <p class="pd-price">
                        <span class="pd-price1">￥</span>
                        <span class="pd-price2">8980</span>
                        <span class="pd-price3">起</span>
                    </p>
                    <p class="pd-day">5天4晚</p>
                </div>
            </div>
        </li>
        <li>
            <div class="popular-list-img">
                <img class="popular-list-img1"
                    src="https://gallery.youxiake.com/product/line/202412/23/1734948809053yKT25.jpg?imageMogr2/auto-orient/gravity/Center/crop/1000x750/blur/1x0/quality/100"
                    alt="">
                <img class="popular-list-img2" src="https://m.youxiake.com/20250904175225/img/5.e268cece.png" alt="">
                <div class="popular-list-img3">
                    <img src="https://m.youxiake.com/20250904175225/img/fire.ced59379.png" alt="">
                    <p>213人已报名</p>
                </div>
            </div>
            <div class="popular-list-bottom">
                <p class="popular-type">徒步登山·安曼出发</p>
                <p class="popular-name">神秘约旦</p>
                <div class="popular-pd">
                    <p class="pd-price">
                        <span class="pd-price1">￥</span>
                        <span class="pd-price2">14988</span>
                        <span class="pd-price3">起</span>
                    </p>
                    <p class="pd-day">8天7晚</p>
                </div>
            </div>
        </li>
    </ul>
    <div class="gif">
        <div class="gif1">
            9月
        </div>
    </div>
    <div class="circle">
        <p class="circle-swim">环球畅游</p>
        <ul class="circle-list">
            <li>
                <img class="circle-list1"
                    src="https://qimg4.youxiake.com/upload1756174827453jOv6z.jpg?imageMogr2/auto-orient/thumbnail/!218x290r/strip/gravity/Center/crop/!218x290/quality/90"
                    alt="">
                <img class="circle-list2" src="https://m.youxiake.com/20250905110037/img/img01.2ce46a79.png" alt="">
            </li>
            <li>
                <img class="circle-list1"
                    src="https://qimg4.youxiake.com/upload/202507/01/7bec7dc0ee2db008.jpg?imageMogr2/auto-orient/thumbnail/!218x290r/strip/gravity/Center/crop/!218x290/quality/90"
                    alt="">
                <img class="circle-list2" src="https://m.youxiake.com/20250905110037/img/img01.2ce46a79.png" alt="">
            </li>
            <li>
                <img class="circle-list1"
                    src="https://qimg4.youxiake.com/upload/202508/07/62171a597dfe267b.png?imageMogr2/auto-orient/thumbnail/!218x290r/strip/gravity/Center/crop/!218x290/quality/90"
                    alt="">
                <img class="circle-list2" src="https://m.youxiake.com/20250905110037/img/img01.2ce46a79.png" alt="">
            </li>
            <li>
                <img class="circle-list1"
                    src="https://qimg4.youxiake.com/upload/202508/12/d774b69b9419b15d.jpg?imageMogr2/auto-orient/thumbnail/!218x290r/strip/gravity/Center/crop/!218x290/quality/90"
                    alt="">
                <img class="circle-list2" src="https://m.youxiake.com/20250905110037/img/img01.2ce46a79.png" alt="">
            </li>
            <li>
                <img class="circle-list1"
                    src="https://qimg4.youxiake.com/upload/202508/06/639ad5cba9a28b8d.jpg?imageMogr2/auto-orient/thumbnail/!218x290r/strip/gravity/Center/crop/!218x290/quality/90"
                    alt="">
                <img class="circle-list2" src="https://m.youxiake.com/20250905110037/img/img01.2ce46a79.png" alt="">
            </li>
            <li>
                <img class="circle-list1"
                    src="https://qimg4.youxiake.com/upload/202507/16/714754b04ab87125.jpg?imageMogr2/auto-orient/thumbnail/!218x290r/strip/gravity/Center/crop/!218x290/quality/90"
                    alt="">
                <img class="circle-list2" src="https://m.youxiake.com/20250905110037/img/img01.2ce46a79.png" alt="">
            </li>
        </ul>
    </div>
    <div class="today">
        <p class="today-p1">当季目的地</p>
        <div class="today-p2">
            <p>查看更多</p>
            <img src="https://m.youxiake.com/20250905110037/img/rightArrow.ff5dfaac.png" alt="">
        </div>
    </div>
    <ul class="niboer"></ul>
    <ul class="outbound"></ul>
    <div class="SelectOption__option">
        <div class="option__selectBtn">
            <span class="name">主题玩法</span>
            <span class="arrowDown"></span>
        </div>
        <div class="option__selectBtn">
            <span class="name">行程天数</span>
            <span class="arrowDown"></span>
        </div>
        <div class="option__selectBtn">
            <span class="name">出发日期</span>
            <span class="arrowDown"></span>
        </div>
    </div>
    <ul class="go"></ul>
</body>
<script src="js/reset.js"></script>
<script src="js/swiper.min.js"></script>
<script>
    fetch('https://m.youxiake.com/api/m/channel/outbound?sitecode=39&city_id').then(res => res.json()).then(res1 => {
        console.log(res1)
        const swiperWrapper = document.querySelector('.swiper-wrapper');
        const niboer = document.querySelector('.niboer');
        const outbound = document.querySelector('.outbound');
        res1.data.banner.forEach(item => {
            swiperWrapper.innerHTML += `
        <div class="swiper-slide">
          <img src="${item.image}" alt="">
        </div>
      `;
        });
        var swiper = new Swiper('.swiper-container', {
            pagination: '.swiper-pagination',
            paginationClickable: true,
            spaceBetween: 30,
            centeredSlides: true,
            autoplay: 2500,
            autoplayDisableOnInteraction: false
        });
        res1.data.mdd.forEach(item => {
            niboer.innerHTML += `
                <li>
                    <img src="${item.image}" alt="">
                    <p class="niboer-p1">${item.title}</p>
                    <p class="niboer-p2">${item.subTitle}</p>
                </li>
            `
        })
        res1.data.flowTags.mddTags.forEach(item => {
            outbound.innerHTML += `
                <li>${item.title}</li>
            `
        })
    }).catch(err => {
        console.log(err)
    })
    fetch('https://m.youxiake.com/api/m/channel/outbound/flow?daysId=&end=&mdd=&page=1&start=&startDate=&themeId=&sitecode=39')
  .then(res => res.json())
  .then(res1 => {
    console.log(res1);
    const go = document.querySelector('.go');
    go.innerHTML = ''; // 清空列表

    // 修正数据路径：使用 res1.data.list（根据实际接口调整）
    const list = res1.data?.list || res1.data?.data?.list || [];
    if (!Array.isArray(list)) {
      go.innerHTML = '<li>暂无数据</li>';
      return;
    }

    list.forEach(item => {
      // 处理 type=1（产品）
      if (item.type === 1 && item.dataDetail) {
        const detail = item.dataDetail;
        
        // 1. 正确定义 zaoniao（移到循环内，用字符串拼接，增加安全判断）
        const zaoniao = detail.manjian_early?.[0]?.detailRemark === '早鸟特惠'
          ? `<span class="discount">${detail.manjian_early[0].detailRemark}</span>`
          : '';

        // 2. 处理亮点数组（转为字符串）
        const liangdian = Array.isArray(detail.liangdian) ? detail.liangdian.join('、') : '';

        go.innerHTML += `
          <li>
            <div class="go__img">
              <img src="${detail.image || ''}" alt="" onerror="this.src='默认图地址'">
              <p class="gosp">${detail.placeLabel || ''}</p>
              <!-- 只在有"爆品"标签时显示 -->
              ${detail.tagList?.includes('爆品') ? '<p class="bao">爆品</p>' : ''}
            </div>
            <p class="gotitle">${detail.title || ''}</p>
            <p class="gotype">
              <span>${detail.productType || ''} •</span>
              <span>${detail.productCat || ''} •</span>
              <span>${detail.days || ''}</span>
            </p>
            <p class="tags">
              ${zaoniao}
              ${liangdian ? `<span class="tag">${liangdian}</span>` : ''}
            </p>
            <div class="price__content">
              <div class="price">￥<span>${detail.priceLabel || ''}</span>起</div>
              <div class="enroll__num">${detail.numLabel || ''}</div>
            </div>
          </li>
        `;
      }
      // 处理其他类型（如合集）
      else {
        if (item.dataDetail) {
          go.innerHTML += `
            <li>
              <div class="img__box">
                <img src="${item.dataDetail.image || ''}" alt="">
                <p>${item.dataDetail.title || ''}</p>
              </div>
            </li>
          `;
        }
      }
    });
  })
  .catch(err => {
    console.log(err);
  });
</script>

</html>